package d1208.Ljs2.Ljs5;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class Demo1 {
    public static void main(String[] args) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        Class<?> aClass = Class.forName("Ljs2.Ljs5.Cat");
        Constructor<?> constructor = aClass.getConstructor();
        Object o = constructor.newInstance();
        Method setName = aClass.getMethod("setName", String.class);
        Object o1 = setName.invoke(o, "大黄");

    }
}
